<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>

		<title>用户角色</title>
		<%@ include file="/easyprepay/jsp/common/head.jsp"%>
		<%@ taglib uri="/easyprepay" prefix="easy"%>
		<script type="text/javascript">
			function delRole(roleName,id){
			if (confirm("您确定要删除"+" "+roleName+"?")){
				
				location.href="<%=basePath%>userRole.do?method=delRole&roleId="+id;
			}	
			}
			function add(){
				location.href="<%=basePath%>easyprepay/jsp/role/addUserRole.jsp";
			}
			function setRoleFunction(Id,RoleName){
				location.href="<%=basePath%>userRole.do?method=setRoleFunction&roleId="+Id+"&roleName="+RoleName;
			}
		</script>

	</head>

	<body><div align="center"> 
		设置用户角色权限 
		</div><hr>
		<table border=1 width="100%" without cellpadding>
			<tr>
				<td>
					编号
				</td>
				<td>
					角色
				</td>
				<td colspan="2">
					<center>
						操作
					</center>
				</td>
			</tr>
			<%!String roleName;
	String id;%>

			<%
				//获取用户角色集合

				List<Role> allUserRole = (List<Role>) request
						.getAttribute("allUserRole");

				for (int i = 0; i < allUserRole.size(); i++) {
					roleName = allUserRole.get(i).getRoleName();
					id = allUserRole.get(i).getId();
			%>

			<tr>
				<td><%=i + 1%></td>
				<td><%=allUserRole.get(i).getRoleName()%></td>



				<td>
					<input type="button" value="删除"
						onclick='delRole("<%=roleName%>","<%=id%>")'>
				</td>
				<td>
				<input type="button" onclick='setRoleFunction("<%=allUserRole.get(i).getId()%>","<%= allUserRole.get(i).getRoleName() %>")' value="设置权限">
				</td>
			</tr>

			
			<%
				}
			%>
			<tr>
				<td colspan="5" align="right">
					<input type="button" value="添加角色" onclick="add()">
				</td>
			</tr>
		</table>
	</body>
</html>
